package ws.very.android.util.async.askbox;

import java.util.Timer;


public class TimeoutAskBoxMsg extends AskBoxMsg {

	
	public <T> AskBox<T> make(final String key, Timer timer, long timeout) {
		return new TimeoutAskBox<T>(timer, timeout) {
			@Override
			public synchronized void complete(Object v) {
				remove(key);
				super.complete(v);
			}
		};
	}

	public <T> AskBox<T> newBox(String key, Timer timer, long timeout) {
		return (AskBox<T>) put(key, make(key, timer, timeout));
	}

}
